package com.mercury.ec.module.air.dal.mysql.order;

import com.mercury.ec.framework.common.pojo.PageResult;
import com.mercury.ec.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.mercury.ec.framework.mybatis.core.mapper.BaseMapperX;
import com.mercury.ec.module.air.controller.admin.order.vo.orderprice.AirOrderPricePageReqVO;
import com.mercury.ec.module.air.dal.dataobject.order.AirOrderPriceDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 机票订单价格 Mapper
 *
 * @author hesx
 */
@Mapper
public interface AirOrderPriceMapper extends BaseMapperX<AirOrderPriceDO> {

    default PageResult<AirOrderPriceDO> selectPage(AirOrderPricePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AirOrderPriceDO>()
                .eqIfPresent(AirOrderPriceDO::getOriginOrderPriceId, reqVO.getOriginOrderPriceId())
                .eqIfPresent(AirOrderPriceDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(AirOrderPriceDO::getOrderRouteId, reqVO.getOrderRouteId())
                .eqIfPresent(AirOrderPriceDO::getOrderPassengerId, reqVO.getOrderPassengerId())
                .likeIfPresent(AirOrderPriceDO::getAirlineIssueNo, reqVO.getAirlineIssueNo())
                .likeIfPresent(AirOrderPriceDO::getTicketNo, reqVO.getTicketNo())
                .likeIfPresent(AirOrderPriceDO::getTicketVendingMachineNo, reqVO.getTicketVendingMachineNo())
                .eqIfPresent(AirOrderPriceDO::getTicketStatus, reqVO.getTicketStatus())
                .eqIfPresent(AirOrderPriceDO::getTicketFailCause, reqVO.getTicketFailCause())
                .eqIfPresent(AirOrderPriceDO::getChangeStatus, reqVO.getChangeStatus())
                .eqIfPresent(AirOrderPriceDO::getChangeUserId, reqVO.getChangeUserId())
                .eqIfPresent(AirOrderPriceDO::getChangeDeptId, reqVO.getChangeDeptId())
                .betweenIfPresent(AirOrderPriceDO::getChangeTime, reqVO.getChangeTime())
                .eqIfPresent(AirOrderPriceDO::getReturnStatus, reqVO.getReturnStatus())
                .eqIfPresent(AirOrderPriceDO::getReturnType, reqVO.getReturnType())
                .eqIfPresent(AirOrderPriceDO::getReturnUserId, reqVO.getReturnUserId())
                .eqIfPresent(AirOrderPriceDO::getReturnDeptId, reqVO.getReturnDeptId())
                .betweenIfPresent(AirOrderPriceDO::getReturnTime, reqVO.getReturnTime())
                .eqIfPresent(AirOrderPriceDO::getAdjustStatus, reqVO.getAdjustStatus())
                .eqIfPresent(AirOrderPriceDO::getAdjustType, reqVO.getAdjustType())
                .eqIfPresent(AirOrderPriceDO::getAdjustUserId, reqVO.getAdjustUserId())
                .eqIfPresent(AirOrderPriceDO::getAdjustDeptId, reqVO.getAdjustDeptId())
                .betweenIfPresent(AirOrderPriceDO::getAdjustTime, reqVO.getAdjustTime())
                .eqIfPresent(AirOrderPriceDO::getSaleAdditionalFee, reqVO.getSaleAdditionalFee())
                .eqIfPresent(AirOrderPriceDO::getSaleServiceFee, reqVO.getSaleServiceFee())
                .eqIfPresent(AirOrderPriceDO::getSaleUpgradeFee, reqVO.getSaleUpgradeFee())
                .eqIfPresent(AirOrderPriceDO::getSaleChangeFee, reqVO.getSaleChangeFee())
                .eqIfPresent(AirOrderPriceDO::getSaleReturnFee, reqVO.getSaleReturnFee())
                .eqIfPresent(AirOrderPriceDO::getSaleTicketPrice, reqVO.getSaleTicketPrice())
                .eqIfPresent(AirOrderPriceDO::getSalePrice, reqVO.getSalePrice())
                .eqIfPresent(AirOrderPriceDO::getSaleUsedPrice, reqVO.getSaleUsedPrice())
                .eqIfPresent(AirOrderPriceDO::getSaleAirportTax, reqVO.getSaleAirportTax())
                .eqIfPresent(AirOrderPriceDO::getSaleOilTax, reqVO.getSaleOilTax())
                .eqIfPresent(AirOrderPriceDO::getSaleTax, reqVO.getSaleTax())
                .eqIfPresent(AirOrderPriceDO::getSaleAgencyFeeRate, reqVO.getSaleAgencyFeeRate())
                .eqIfPresent(AirOrderPriceDO::getSaleAgencyFee, reqVO.getSaleAgencyFee())
                .eqIfPresent(AirOrderPriceDO::getSaleBackRebateFeeRate, reqVO.getSaleBackRebateFeeRate())
                .eqIfPresent(AirOrderPriceDO::getSaleBackRebateFee, reqVO.getSaleBackRebateFee())
                .eqIfPresent(AirOrderPriceDO::getSalePrizePrice, reqVO.getSalePrizePrice())
                .eqIfPresent(AirOrderPriceDO::getSalePrizeTax, reqVO.getSalePrizeTax())
                .eqIfPresent(AirOrderPriceDO::getSaleAmount, reqVO.getSaleAmount())
                .eqIfPresent(AirOrderPriceDO::getSaleReceivable, reqVO.getSaleReceivable())
                .eqIfPresent(AirOrderPriceDO::getSaleReceipts, reqVO.getSaleReceipts())
                .eqIfPresent(AirOrderPriceDO::getSalePayStatus, reqVO.getSalePayStatus())
                .eqIfPresent(AirOrderPriceDO::getSalePaySubjectId, reqVO.getSalePaySubjectId())
                .eqIfPresent(AirOrderPriceDO::getSalePayTypeId, reqVO.getSalePayTypeId())
                .likeIfPresent(AirOrderPriceDO::getSalePayAccount, reqVO.getSalePayAccount())
                .likeIfPresent(AirOrderPriceDO::getSalePayOrderNo, reqVO.getSalePayOrderNo())
                .betweenIfPresent(AirOrderPriceDO::getSalePayTime, reqVO.getSalePayTime())
                .eqIfPresent(AirOrderPriceDO::getSalePayOnline, reqVO.getSalePayOnline())
                .eqIfPresent(AirOrderPriceDO::getPurchaseId, reqVO.getPurchaseId())
                .likeIfPresent(AirOrderPriceDO::getPurchaseOrderNo, reqVO.getPurchaseOrderNo())
                .eqIfPresent(AirOrderPriceDO::getPurchaseAdditionalFee, reqVO.getPurchaseAdditionalFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseServiceFee, reqVO.getPurchaseServiceFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseUpgradeFee, reqVO.getPurchaseUpgradeFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseChangeFee, reqVO.getPurchaseChangeFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseReturnFee, reqVO.getPurchaseReturnFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseTicketPrice, reqVO.getPurchaseTicketPrice())
                .eqIfPresent(AirOrderPriceDO::getPurchasePrice, reqVO.getPurchasePrice())
                .eqIfPresent(AirOrderPriceDO::getPurchaseUsedPrice, reqVO.getPurchaseUsedPrice())
                .eqIfPresent(AirOrderPriceDO::getPurchaseAirportTax, reqVO.getPurchaseAirportTax())
                .eqIfPresent(AirOrderPriceDO::getPurchaseOilTax, reqVO.getPurchaseOilTax())
                .eqIfPresent(AirOrderPriceDO::getPurchaseTax, reqVO.getPurchaseTax())
                .eqIfPresent(AirOrderPriceDO::getPurchaseAgencyFeeRate, reqVO.getPurchaseAgencyFeeRate())
                .eqIfPresent(AirOrderPriceDO::getPurchaseAgencyFee, reqVO.getPurchaseAgencyFee())
                .eqIfPresent(AirOrderPriceDO::getPurchaseBackRebateFeeRate, reqVO.getPurchaseBackRebateFeeRate())
                .eqIfPresent(AirOrderPriceDO::getPurchaseBackRebateFee, reqVO.getPurchaseBackRebateFee())
                .eqIfPresent(AirOrderPriceDO::getPurchasePrizePrice, reqVO.getPurchasePrizePrice())
                .eqIfPresent(AirOrderPriceDO::getPurchasePrizeTax, reqVO.getPurchasePrizeTax())
                .eqIfPresent(AirOrderPriceDO::getPurchaseAmount, reqVO.getPurchaseAmount())
                .eqIfPresent(AirOrderPriceDO::getPurchasePayable, reqVO.getPurchasePayable())
                .eqIfPresent(AirOrderPriceDO::getPurchasePayment, reqVO.getPurchasePayment())
                .eqIfPresent(AirOrderPriceDO::getPurchasePayStatus, reqVO.getPurchasePayStatus())
                .eqIfPresent(AirOrderPriceDO::getPurchasePaySubjectId, reqVO.getPurchasePaySubjectId())
                .eqIfPresent(AirOrderPriceDO::getPurchasePayTypeId, reqVO.getPurchasePayTypeId())
                .likeIfPresent(AirOrderPriceDO::getPurchasePayAccount, reqVO.getPurchasePayAccount())
                .likeIfPresent(AirOrderPriceDO::getPurchasePayOrderNo, reqVO.getPurchasePayOrderNo())
                .betweenIfPresent(AirOrderPriceDO::getPurchasePayTime, reqVO.getPurchasePayTime())
                .eqIfPresent(AirOrderPriceDO::getPurchasePayOnline, reqVO.getPurchasePayOnline())
                .betweenIfPresent(AirOrderPriceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AirOrderPriceDO::getId));
    }

    default List<AirOrderPriceDO> selectByOrderId(Long orderId) {
        return selectList(AirOrderPriceDO::getOrderId, orderId);
    }

    default void deleteByOrderId(Long orderId) {
        delete(AirOrderPriceDO::getOrderId, orderId);
    }
}
